package a66weding.com.jiehuntong.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import a66weding.com.jiehuntong.R;


/**
 * Created by admin on 2016/7/20.
 * 任务;
 */
public class MyTaskActivity extends Activity implements View.OnClickListener{
    private RelativeLayout back_R;
    private RelativeLayout myTask_group_r;
    private RelativeLayout myReleaseTask_group_r;
    private  int flag = 0;
    public static String WhateOfTask = "Task";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_task);
        initView();
    }
    private void initView(){
        back_R  = (RelativeLayout) findViewById(R.id.mytask_back);
        back_R.setOnClickListener(this);
        myTask_group_r = (RelativeLayout) findViewById(R.id.myTask_group_r);
        myTask_group_r.setOnClickListener(this);
        myReleaseTask_group_r = (RelativeLayout) findViewById(R.id.myReleaseTask_group_r);
        myReleaseTask_group_r.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.mytask_back:
               finish();
                break;

            //点击我的任务;
            case R.id.myTask_group_r:
                flag = 1;
                startIntent(flag);
                break;

            //点击我发布的任务
            case R.id.myReleaseTask_group_r:
                flag = 2;
                startIntent(flag);
                break;
        }
    }

    public void  startIntent(int flag){
       Intent intent = new Intent(this,TaskActivity.class);
        intent.putExtra(WhateOfTask,flag);
        startActivity(intent);
    }
}
